<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/temp.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>RetivalUser</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<style type="text/css">
<!--
.ListStyle {font-family: Arial, Helvetica, sans-serif}
.STYLE4 {font-size: 10px}
.STYLE7 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; }
.forLink {font-size: 24px }
.STYLE10 {font-family: Arial, Helvetica, sans-serif; font-size: 24px; }
a:link {text-decoration: none;}
a:visited {text-decoration: none;}
a:active {text-decoration: none;}
a:hover {text-decoration: none;}
-->

</style>
</head>

<body  style="background-image:url(../../images/websitebackgrund.png);">
<table width="802" border="0" align="center">
<tr><td colspan="4"><a href="../../view/User/userlogin.php" class="STYLE7"><img src="../../images/logo.jpg" alt="Home Page"  border="0" /></a> 
  
    </td>
</tr>

  <tr>
  <td width="175" ><div align="center"><a href="../../view/User/userlogin.php" class="STYLE10">User Login</a> </div></td>
    <td width="305"><div align="center"><a href="../../view/SuperUser/superUserLogin.php" class="STYLE10">Super User Login</a> </div></td>
    <td width="232"><div align="center"><a href="../../view/Manager/managerLogin.php" class="STYLE10">Manager Login</a> </div></td>
    <td width="291"><div align="center"><a href="../../view/Admin/adminLogin.php" class="STYLE10">Adminster Login</a> </div></td>
  </tr>  <tr>
    <td >&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<!-- InstanceBeginEditable name="EditRegion" -->
<p>
  <?php 
include ("../../Connections/cpsms.php");
	$name = $_POST['namepost'];
	$position = $_POST['positionpost'];
	$postrank = $_POST['rankpost'];
	$postgender = $_POST['genderpost'];
	$political = $_POST['politicalpost'];
	$data = $_POST['datapost'];
	$year = $_POST['yearpost'];
	$month = $_POST['monthpost'];
	$day = $_POST['daypost'];
	$year2 = $_POST['year2post'];
	$month2 = $_POST['month2post'];
	$day2 = $_POST['day2post'];


	if($year != 'year' or $month != 'month'or $day != 'day'or $year2 != 'year'
		or $month2 != 'month'or $day2 != 'day'){
	  if($year < 1800 or $year>2200){
	   		echo "<script language='javascript'>";  
	   		echo " location='../../view/SuperUser/RetrivalUser.php?id=3';"; 
       		echo "</script>";
		}
	  if($month < 1 or $month>12){
	   		echo "<script language='javascript'>";  
	   		echo " location='../../view/SuperUser/RetrivalUser.php?id=4';"; 
       		echo "</script>";
		}
	  if($day < 1 or $day>31){
	  		echo "<script language='javascript'>";  
	   		echo " location='../../view/SuperUser/RetrivalUser.php?id=5';"; 
       		echo "</script>";
	  	}
	  if($year2 < 1800 or $year2>2200){
	  	 	echo "<script language='javascript'>";  
	   		echo " location='../../view/SuperUser/RetrivalUser.php?id=3';"; 
       		echo "</script>";
		}
	  if($month2 < 1 or $month2>12){
	   		echo "<script language='javascript'>";  
	   		echo " location='../../view/SuperUser/RetrivalUser.php?id=6';"; 
       		echo "</script>";
		}
	  if($day2 < 1 or $day2>31){
	  		 echo "<script language='javascript'>";  
	   		echo " location='../../view/SuperUser/RetrivalUser.php?id=7';"; 
       		echo "</script>";
		}
	}

	if($name == NULL and $position == NULL and $postrank == NULL and $postgender == 0
	  and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	  and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
	  echo "<script language='javascript'>";  
	  echo " location='../../view/SuperUser/RetrivalUser.php?id=1';"; 
      echo "</script>";
	}
	
	// one situation.
	else if($name != NULL and $position == NULL and $postrank == NULL and $postgender == 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name == NULL and $position != NULL and $postrank == NULL and $postgender == 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where CurrentPosition='$position';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name == NULL and $position == NULL and $postrank != NULL and $postgender == 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where Rank='$postrank';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name == NULL and $position == NULL and $postrank == NULL and $postgender != 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where Gender='$postgender';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name == NULL and $position == NULL and $postrank == NULL and $postgender == 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	
	// two situation for name.
	else if($name != NULL and $position != NULL and $postrank == NULL and $postgender == 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and CurrentPosition = '$position';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position == NULL and $postrank != NULL and $postgender == 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and Rank='$postrank';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position == NULL and $postrank == NULL and $postgender != 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and Gender='$postgender';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position == NULL and $postrank == NULL and $postgender == 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	
	// tree situation for name.
	else if($name != NULL and $position != NULL and $postrank != NULL and $postgender == 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and CurrentPosition = '$position' and Rank='$postrank';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position != NULL and $postrank == NULL and $postgender != 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and CurrentPosition = '$position' 
				 and Gender='$postgender';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position != NULL and $postrank == NULL and $postgender == 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and CurrentPosition = '$position' 
				 and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position == NULL and $postrank != NULL and $postgender != 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and Rank='$postrank' and Gender='$postgender';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position == NULL and $postrank != NULL and $postgender == 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and Rank='$postrank' and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position == NULL and $postrank == NULL and $postgender != 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and Gender='$postgender' and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	
	// four situation for nameand five for all.
	else if($name != NULL and $position != NULL and $postrank != NULL and $postgender != 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and CurrentPosition = '$position' and Rank='$postrank'
			 and Gender='$postgender';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position != NULL and $postrank != NULL and $postgender == 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and CurrentPosition = '$position' and Rank='$postrank'
			 and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position == NULL and $postrank != NULL and $postgender != 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and Gender='$postgender' and Rank='$postrank'
			 and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position != NULL and $postrank == NULL and $postgender != 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and Gender='$postgender' and CurrentPosition = '$position'
			 and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name != NULL and $position != NULL and $postrank != NULL and $postgender != 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where username='$name' and CurrentPosition = '$position' and Rank='$postrank'
			 and Gender='$postgender' and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	
	
	// two situation for position.
	else if($name == NULL and $position != NULL and $postrank != NULL and $postgender == 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where CurrentPosition = '$position' and Rank='$postrank';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name == NULL and $position != NULL and $postrank == NULL and $postgender != 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where CurrentPosition = '$position' and Gender='$postgender';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name == NULL and $position != NULL and $postrank == NULL and $postgender == 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where CurrentPosition = '$position' and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	
	// tree situation for position and four for all.
	else if($name == NULL and $position != NULL and $postrank != NULL and $postgender != 0
	   and $political == NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where CurrentPosition = '$position' and Rank='$postrank'
					and Gender='$postgender';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name == NULL and $position != NULL and $postrank != NULL and $postgender == 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where CurrentPosition = '$position' and Rank='$postrank'
					and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name == NULL and $position != NULL and $postrank == NULL and $postgender != 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where CurrentPosition = '$position' and Gender='$postgender'
					and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name == NULL and $position != NULL and $postrank != NULL and $postgender != 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where CurrentPosition = '$position' and Gender='$postgender'
					and Political='$political'and Rank='$postrank';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	
	// two situation for rank.
	else if($name == NULL and $position == NULL and $postrank != NULL and $postgender != 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where Rank='$postrank' and Gender='$postgender';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	else if($name == NULL and $position == NULL and $postrank != NULL and $postgender == 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where Rank='$postrank' and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	
	// three situation for rank.
	else if($name == NULL and $position == NULL and $postrank != NULL and $postgender != 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where Rank='$postrank' and Gender='$postgender'and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	
	else if($name == NULL and $position == NULL and $postrank == NULL and $postgender != 0
	   and $political != NULL and $data == 0 and $year == 'year' and $month == 'month' 
	   and $day == 'day' and $year2 == 'year' and $month2 == 'month' and $day2 == 'day'){
 	$query = "select * from users where Gender='$postgender' and Political='$political';";
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
	}
	// 1.
	else if($name == NULL and $position == NULL and $postrank == NULL and $postgender == 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where $data between '$year-$month-$day' and
				          '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where $data between
				           '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where $data between
				           '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where $data between
				          '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where $data between
				          '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where $data between
				          '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name != NULL and $position == NULL and $postrank == NULL and $postgender == 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and 
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and 
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and 
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name == NULL and $position != NULL and $postrank == NULL and $postgender == 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where CurrentPosition='$position' and 
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where CurrentPosition='$position' and 
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where CurrentPosition='$position' and 
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where CurrentPosition='$position' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where CurrentPosition='$position' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where CurrentPosition='$position' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name == NULL and $position == NULL and $postrank != NULL and $postgender == 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Rank='$postrank' and 
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Rank='$postrank' and 
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Rank='$postrank' and 
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Rank='$postrank' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Rank='$postrank' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Rank='$postrank' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name == NULL and $position == NULL and $postrank == NULL and $postgender != 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Gender='$postgender' and 
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Gender='$postgender' and 
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Gender='$postgender' and 
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Gender='$postgender' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Gender='$postgender' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Gender='$postgender' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name == NULL and $position == NULL and $postrank == NULL and $postgender == 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Political='$political' and 
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Political='$political' and 
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Political='$political' and 
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Political='$political' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Political='$political' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Political='$political' and 
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	//name 2.
	else if($name != NULL and $position != NULL and $postrank == NULL and $postgender == 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name != NULL and $position == NULL and $postrank != NULL and $postgender == 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and Rank='$postrank' and
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and Rank='$postrank' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and Rank='$postrank' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and Rank='$postrank' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and Rank='$postrank' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and Rank='$postrank' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name != NULL and $position == NULL and $postrank == NULL and $postgender != 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and Gender='$postgender' and
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and Gender='$postgender' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and Gender='$postgender' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and Gender='$postgender' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and Gender='$postgender' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and Gender='$postgender' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}	
	else if($name != NULL and $position == NULL and $postrank == NULL and $postgender == 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and Political='$political' and
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and Political='$political' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and Political='$political' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
	}
	
	//name 3.
	else if($name != NULL and $position != NULL and $postrank != NULL and $postgender == 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position'
				  and Rank='$postrank' and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	else if($name != NULL and $position != NULL and $postrank == NULL and $postgender != 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Gender='$postgender' and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Gender='$postgender' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Gender='$postgender' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Gender='$postgender' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Gender='$postgender' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Gender='$postgender' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	else if($name != NULL and $position != NULL and $postrank == NULL and $postgender == 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	else if($name != NULL and $position == NULL and $postrank != NULL and $postgender != 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and Rank='$postrank' 
				 and Gender='$postgender' and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and Rank='$postrank' 
				 and Gender='$postgender' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and Rank='$postrank' 
				 and Gender='$postgender' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and Rank='$postrank' 
				 and Gender='$postgender' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and Rank='$postrank' 
				 and Gender='$postgender' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and Rank='$postrank' 
				 and Gender='$postgender' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	else if($name != NULL and $position == NULL and $postrank != NULL and $postgender == 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and Rank='$postrank' 
				 and Political='$political' and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and Rank='$postrank'
				 and Political='$political' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and Rank='$postrank'
				 and Political='$political' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and Rank='$postrank'
				 and Political='$political' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and Rank='$postrank' 
				 and Political='$political' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and Rank='$postrank' 
				 and Political='$political' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	else if($name != NULL and $position == NULL and $postrank == NULL and $postgender != 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Political='$political' and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Political='$political' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Political='$political' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and Gender='$postgender'
				 and Political='$political' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Political='$political' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Political='$political' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	//name 4.
	else if($name != NULL and $position != NULL and $postrank != NULL and $postgender != 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Gender='$postgender' 
				 and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank'and Gender='$postgender' 
				 and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Gender='$postgender' 
				 and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Gender='$postgender' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Gender='$postgender' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Gender='$postgender' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	else if($name != NULL and $position != NULL and $postrank != NULL and $postgender == 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank'and Political='$political' 
				 and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	else if($name != NULL and $position != NULL and $postrank == NULL and $postgender != 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and Gender='$postgender' 
				 and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political'and Gender='$postgender' 
				 and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and Gender='$postgender' 
				 and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and Gender='$postgender' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and Gender='$postgender' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Political='$political' and Gender='$postgender' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	else if($name != NULL and $position == NULL and $postrank != NULL and $postgender != 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Rank='$postrank'and Political='$political' 
				 and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and Gender='$postgender' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	//all.
	else if($name != NULL and $position != NULL and $postrank != NULL and $postgender != 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Political='$political' 
				 and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Gender='$postgender' and Political='$political' 
				 and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Gender='$postgender' and Political='$political' 
				 and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Gender='$postgender' and Political='$political' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Gender='$postgender' and Political='$political' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where username='$name' and CurrentPosition='$position' 
				 and Rank='$postrank' and Gender='$postgender' and Political='$political' 
				 and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			 			
	}
	
	//position 2.
	else if($name == NULL and $position != NULL and $postrank != NULL and $postgender == 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Rank='$postrank' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Rank='$postrank' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Rank='$postrank' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Rank='$postrank' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Rank='$postrank' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Rank='$postrank' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name == NULL and $position != NULL and $postrank == NULL and $postgender != 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Gender='$postgender' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Gender='$postgender' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Gender='$postgender' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Gender='$postgender' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Gender='$postgender' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Gender='$postgender' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name == NULL and $position != NULL and $postrank == NULL and $postgender == 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Political='$political' and CurrentPosition='$position' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Political='$political' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	
	//position 3
	else if($name == NULL and $position != NULL and $postrank != NULL and $postgender != 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Gender='$postgender' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Gender='$postgender' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Gender='$postgender' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Gender='$postgender' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Gender='$postgender' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Gender='$postgender' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name == NULL and $position != NULL and $postrank != NULL and $postgender == 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position' 
				 and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name == NULL and $position != NULL and $postrank == NULL and $postgender != 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Gender='$postgender' and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Gender='$postgender' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Gender='$postgender' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Gender='$postgender' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Gender='$postgender' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position' 
				 and Gender='$postgender' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	
	//position 4
	else if($name == NULL and $position != NULL and $postrank != NULL and $postgender != 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Gender='$postgender' and Rank='$postrank' and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Gender='$postgender' and Rank='$postrank' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Gender='$postgender' and Rank='$postrank' and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Gender='$postgender' and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Political='$political' and CurrentPosition='$position'
				 and Gender='$postgender' and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Political='$political' and CurrentPosition='$position' 
				 and Gender='$postgender' and Rank='$postrank' and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	
	// rank 2
	else if($name == NULL and $position == NULL and $postrank != NULL and $postgender != 0
	       and $political == NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name == NULL and $position == NULL and $postrank != NULL and $postgender == 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Rank='$postrank' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	else if($name == NULL and $position == NULL and $postrank != NULL and $postgender != 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Rank='$postrank' and Political='$political' 
				  and Gender='$postgender'and $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Rank='$postrank' and Political='$political' 
				  and Gender='$postgender'and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Rank='$postrank' and Political='$political' 
				  and Gender='$postgender'and $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Rank='$postrank' and Political='$political'  
				  and Gender='$postgender'and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Rank='$postrank' and Political='$political' 
				  and Gender='$postgender'and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Rank='$postrank' and Political='$political' 
				  and Gender='$postgender'and $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}
	
	
	else if($name == NULL and $position == NULL and $postrank == NULL and $postgender != 0
	       and $political != NULL and $data != 0){
		      	if($data == 1){
					$data = 'DOB';
				  }
		   else if($data == 2){
					$data = 'PartyDate';
	              }
			else if($data == 3){
					$data = 'PoliceWorkDate';
				  }
			else if($data == 4){
					$data = 'WorkDate';
				  }
	          if($year == 'year' or $month == 'month' or $day == 'day' or $year2 == 'year' 
		        or $month2 == 'month' or $day2 == 'day'){
	   			echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=2';"; 
      			echo "</script>";
				}
		      if($year < $year2){
				 $query = "select * from users where Gender='$postgender' and Political='$political' and
				          $data between '$year-$month-$day' and  '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }			  
	     else if($year == $year2 and $month < $month2){
				 $query = "select * from users where Gender='$postgender' and Political='$political' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
			     }
		 else if($year == $year2 and $month == $month2 and $day <= $day2){	
				 $query = "select * from users where Gender='$postgender' and Political='$political' and
				          $data between '$year-$month-$day' and '$year2-$month2-$day2';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);	
				 }
	     else if($year2 < $year){
				 $query = "select * from users where Gender='$postgender' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);		 
		         }
		 else if($year2 == $year and $month2 < $month){
		 	     $query = "select * from users where Gender='$postgender' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
		 else if($year2 == $year and $month2 == $month and $day2 <= $day){
				 $query = "select * from users where Gender='$postgender' and Political='$political' and
				          $data between '$year2-$month2-$day2' and '$year-$month-$day';";
				 $sql = mysql_query($query) or die(mysql_error());
				 $array = mysql_fetch_array($sql);
				 }
				 			
	}

	
	 else{
		   	    echo "<script language='javascript'>";  
	  			echo " location='../../view/SuperUser/RetrivalUser.php?id=8';"; 
      			echo "</script>";
		  }
?>
</p>
<table width="1016" border="0" align="center" bordercolor="#000000">
  <tr>
    <td width="239" height="23">Show Retrival Information </td>
    <td width="511">&nbsp;</td>
    <td width="74">&nbsp;</td>
    <td width="16">&nbsp;</td>
    <td width="22">&nbsp;</td>
    <td width="148"><form id="form4" name="form4" method="post" 
	                action="../../view/SuperUser/RetrivalUser.php">
      <div align="right">
        <input type="submit" name="Submit42" value="Cancel" />
      </div>
    </form></td>
  </tr>
  <tr>
    <td colspan="6"><table width="1030" height="31" border="1" cellspacing="0">
      <tr>
        <td width="66" height="22" class="STYLE1" ><strong>PoliceID</strong></td>
        <td width="89" class="STYLE1" ><strong>ArchiveName</strong></td>
        <td width="48" class="STYLE1" ><strong>Gender</strong></td>
        <td width="89" class="STYLE1" ><strong>DOB</strong></td>
        <td width="32" class="STYLE1" ><strong>Rank</strong></td>
        <td width="120" class="STYLE1" ><strong>Birthplace</strong></td>
        <td width="40" class="STYLE1" ><strong>Ethic</strong></td>
        <td width="104" class="STYLE1"><strong>PoliticalBack</strong></td>
        <td width="120" class="STYLE1"><strong>CurrentPosition</strong></td>
        <td width="80" class="STYLE1" ><strong>ArchiveNo.</strong></td>
        <td width="120" class="STYLE1" ><strong>PoliceWorkDate</strong></td>
        <td width="72" class="STYLE1" ><strong>Details</strong></td>
      </tr>
      <?PHP
   while($array){
      $archiveid = $array['Archiveid'];
      $birthplace = $array['Birthplace'];
      $CurrentPosition = $array['CurrentPosition'];
      $DOB = $array['DOB'];
      $Ethic = $array['Ethic'];
	  $FirstEducation = $array['FirstEducation'];
      $HighestAcademicInstitution = $array['HighestAcademicInstitution'];
      $HighestEducation = $array['HighestEducation'];
      $loginname = $array['loginname'];
      $PartyDate = $array['PartyDate'];
	  $loginpassword = $array['loginpassword'];
      $photo = $array['photo'];
      $PoliceIDNo = $array['PoliceIDNo'];
      $PoliceWorkDate = $array['PoliceWorkDate'];
      $Politicaldata = $array['Political'];
      $Rank = $array['Rank'];
	  $username = $array['username'];
	  $WorkDate = $array['WorkDate'];
	  
	  if($array['Gender'] == 1)
	  {$Gender = "Male";}
	  else if($array['Gender'] == 0)
	  {$Gender = "Female";}
	  else 
	  {$Gender = "";}

      echo ("<tr><td>" .$PoliceIDNo ."</td><td>" .$username ."</td><td>" .$Gender 
	  ."</td><td>" .$DOB ."</td><td>" .$Rank ."</td><td>" .$birthplace ."</td><td>" 
	  .$Ethic ."</td><td>" .$Politicaldata ."</td><td>" .$CurrentPosition ."</td><td>" 
	  ."PC".$archiveid ."</td><td>" .$WorkDate 
	  ."</td><td ><a href='../../view/SuperUser/UserdetailsforSuper.php?id=".$archiveid 
	  ."'>details</a></td></tr>");
      $array = mysql_fetch_array($sql);
   }
?>
    </table></td>
  </tr>
  <tr>
    <td height="31" colspan="6"><table width="346" border="0" align="right">
      <tr>
        <td width="146" height="25">&nbsp;</td>
        <td width="72">&nbsp;</td>
        <td width="24">&nbsp;</td>
        <td width="24">&nbsp;</td>
        <td width="58"><form id="form4" name="form4" method="post" 
		                action="../../view/SuperUser/RetrivalUser.php">
          <div align="right">
            <input type="submit" name="Submit4" value="Cancel" />
          </div>
        </form></td>
      </tr>
    </table></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<!-- InstanceEndEditable --> <div class="ListStyle STYLE4" style="background:#51A2B9">Copyright 2010_CP3047_G24   | E-mail:<a href="mailto:xiaoguang.bian@gmail.com">xiaoguang.bian@gmail.com</a> | Address: BJUT,chaoyangqu 100,Beijing. 10022
</div>
</body>
<!-- InstanceEnd --></html>
